<?php
namespace app\yperp\logic\yp;

class YpSecret
{
    /**
     * 虹创登录密码加解密
     * @param string $string
     * @param string $key
     * @return string
     */
    static function secret($string, $key = '46cc793c53dc451b', $operation = false)
    {
        if ($operation) {
            return openssl_decrypt(base64_decode($string), 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
        }
        return base64_encode(openssl_encrypt($string, 'AES-128-ECB', $key, OPENSSL_RAW_DATA));
    }
}
